<?php

use IDock\Insurance\ACIC\ACICConstruct;
use IDock\Insurance\ACIC\Request\NonCar\NonCarInquiryInfoRequest;
use IDock\Printer\Premium\PremiumInquiryPrinter;
use IDock\Printer\ProposalStatusPrinter;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumCarTaxVisitor;
use IDock\Visitor\Premium\PremiumChargingPileVisitor;
use IDock\Visitor\Premium\PremiumCoverageVisitor;
use IDock\Visitor\Premium\PremiumExtInfoVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\Premium\PremiumPolicyVisitor;
use IDock\Visitor\Premium\PremiumRelationVisitor;
use IDock\Visitor\Premium\PremiumUnderwritingVisitor;
use IDock\Visitor\Premium\PremiumVehicleVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\RenewalInquiryVisitor;
use IDock\Visitor\SpecialClausesVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

require_once('./vendor/autoload.php');

$IDock = new \IDock\IDock\IDock();

$DAJIAConfig = [
    'gateway' => '*************',
    'channelCode' => '*************',
    'channelPwd' => '*************',
    'secretKey' => '*************',
    'deviceType' => '*************',
    'logsDir' => './DAJIALogs',
    'timeout' => '60',
    'proxy' => '*************',
];

$ACICConfig = [
    'gateway' => 'https://plytst.e-acic.com/vchl-channel/services/accessService?wsdl',
    'EChannelId' => '*************',
    'secretKey' => '*************',
    'PCPayUrl' => 'https://plytst.e-acic.com/vchl-channel/upay/upay.htm',
    'WAPPayUrl' => 'https://plytst.e-acic.com/vchl-channel/upay/upayWap.htm',
    'logsDir' => './ACICLogs',
    'timeout' => '10',
    'ip' => '*************',
    'proxy' => '*************',
];

require_once('config.php');

//$IDock->setBean('DAJIA', $DAJIAConfig);

$IDock->setBean('ACIC', $ACICConfig);


global $testResponse;

/*$testResponse = '<?xml version="1.0" encoding="UTF-8"?><Packet>  <Head>    <RequestType>V01</RequestType>    <SerialNo>52f1222aa31389b6bfc7e2d239de3c904e848202</SerialNo>    <ResponseCode>-1</ResponseCode>    <ErrorCode>2005</ErrorCode>    <ErrorMessage>核心提核失败，错误信息如下：投保单号[599510803602023046153] 提核失败,其原因：核保状态(0) 自核结果为：下发修改。单车核保通则库_总部：未上传影像，下发修改 ;     </ErrorMessage>  </Head><Body><ConfirmNo>599510803602023046153599510803662023052284</ConfirmNo><TotalPrem>665.0</TotalPrem><TotalSumlimit>200000.0</TotalSumlimit><TotalPremAndTax>965.0</TotalPremAndTax><CI><CConfirmNo>599510803602023046153</CConfirmNo><Prem>665.0</Prem><Tax>300.0</Tax><UWFlag>0</UWFlag><UWMessage>核保状态(0) 自核结果为：下发修改。单车核保通则库_总部：未上传影像，下发修改 ;     </UWMessage></CI><UWFlag>1</UWFlag></Body></Packet>';*/

/*$testResponse = '<?xml version="1.0" encoding="UTF-8"?><Packet>  <Head>    <RequestType>V00</RequestType>    <SerialNo>19556b2e8fd7cc26b4af48b0f43e8e71ac663672</SerialNo>    <ResponseCode>0</ResponseCode>    <ErrorCode>0000</ErrorCode>    <ErrorMessage>成功</ErrorMessage>  </Head><Body><CI><DupFlag>1</DupFlag><RepeatInfo><EndDate></EndDate><RepeatDesc>E51--交强投保查询与平台交互异常*/
//车险平台返回信息
//号牌号码“川AP0Z64”的保单发生重复投保，与其重复投保的其它公司的保单信息如下：车架号 LVSHFFML4JS720810;发动机号 JJ006888;地区 四川。*</RepeatDesc></RepeatInfo></CI><BI><DupFlag>1</DupFlag><RepeatInfo><EndDate>202308260000</EndDate><RepeatDesc>核心返回结果: 计算完毕 【请注意商业重复投保信息】： 商业：车险平台返回信息 重复投保保单号： PDAA202251010000774064 保险公司代码：PICC 保险公司名称：中国人民财产保险股份有限公司 号牌号码： 号牌种类代码： 号牌种类名称： 车架号：LVSHFFML4JS720810 发动机号：JJ006888 签单日期：20220728 起保日期：202208260000 终保日期：202308260000 重复险别： 0301200 机动车损失保险; 商业：车险平台返回信息 重复投保保单号： 保险公司代码： 保险公司名称： 号牌号码：川AP0Z64 号牌种类代码：02 号牌种类名称：小型汽车号牌 车架号：LVSHFFML4JS720810 发动机号：JJ006888 签单日期： 起保日期： 终保日期： 重复险别： 0301702 机动车车上人员责任保险（乘客）; 0301600 机动车第三者责任保险; 0301003 道路救援服务特约条款; 0301701 机动车车上人员责任保险（司机）; 0301006 代为送检服务特约条款;</RepeatDesc></RepeatInfo></BI></Body></Packet>
//';
//$testResponse = '{"data":"24605DAFCAAACE9D3D1709A1A568DC2DCC1CFB6BBEF4E2C04CB5BA3145E32F2E36CA5976F3F74162A93D6EF1AC5CC5C496A77536C2B96E5C516CEC332718E4798599E28A49EB9E7FE7D3D2E411D59040410E2B66543AA54CF1EE47E55B764DB39CAE4A6EAAA1063265DB9E6FE727720897A180D8EE5BB1D5B74A37FE0336F367C2AAA09B1456418F387DB86CB65517BC1DC488666D327619CDB024E39515418E227BF5B1996E891A7A4BB7CA69974010445DCBD63A49CE56024CFD1AF34CD28A94D6C1A99236F12EAFD7CF7744C2244EF8C5F539541DCE2C2B90057436C93102F61C4A24BEC07AB5B55ADA38594364FFB386160DC67BA1609BB5FF9E9FA370B3","signature":"8cdc2af4310573d1737f9bf5b0c21206","timestamp":"1686037994098"}';

/*$testResponse = '<?xml version="1.0" encoding="UTF-8"?><Packet>  <Head>    <RequestType>V00</RequestType>    <SerialNo>900b13da683b800254562ca2ce635671180fb1eb</SerialNo>    <ResponseCode>-1</ResponseCode>    <ErrorCode>4000</ErrorCode>    <ErrorMessage>交强-该保单属于重复投保，其重复投保信息为：终保日期: 20230922 00:00; 详细信息：{E51--交强投保查询与平台交互异常*/
//车险平台返回信息
//号牌号码“川A4ZL94”的保单发生重复投保，与其重复投保的其它公司的保单信息如下：投保确认码 02TAIC510022080271401597467161;保单号 6503131088120220003458;起保日期 2022-09-22 00:00;终保日期 2023-09-22 00:00;号牌号码 川A4ZL94;号牌种类 02;车架号 LFV2A28V0J5406150;发动机号 SN5971;地区 四川。*};
//E52--商业投保查询与平台交互异常
//车险平台返回信息
//未传送车辆过户标志，查询的车主名称与上张保单不一致。*</ErrorMessage>  </Head></Packet>';


//$shortName = 'DAJIA';
$shortName = 'ACIC';

$vin = 'W1KUG5KBALA570709';
$engineNo = '25693030175391';
$licenseNo = '川AN79V9';
//$licenseNo = '新车';
$firstRegisterDate = '2020-09-24';
$vehicleModel = '奔驰BENZ S450L 臻藏版 全时四驱';

$DAJIAOrderNo = 'D20230606070000002069c21a07d36a4';

$biStartData = '2023-07-10 00:00:00';
$ciStartData = '2023-07-10 00:00:00';
$biEndData = '2024-07-09 23:59:59';
$ciEndData = '2024-07-09 23:59:59';

//$engineNo = 'SVW71217DN';
//$vin = 'LSVGZ6183J2037364';
//续保查询接口
if (0) {
    //续保查询接口
    $renewalInquiryVisitor = new RenewalInquiryVisitor();
    //车架号
    $renewalInquiryVisitor->vin = $vin;
    //发动机号
    $renewalInquiryVisitor->engineNo = $engineNo;
    //车牌号
    $renewalInquiryVisitor->licenseNo = $licenseNo;
    $renewalInquiryVisitor->argc['type'] = 1;


    $response = $IDock->renewalInquiry($shortName, $renewalInquiryVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\RenewalInquiryPrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer->toArray());
    exit;
}

//车辆车型查询接口
if (0) {
    //车辆车型查询接口
    $vehicleModelVisitor = new VehicleModelVisitor();
    //车架号
    $vehicleModelVisitor->vin = $vin;
    //$vehicleModelVisitor->vin = '';
    //发动机号
    $vehicleModelVisitor->engineNo = $engineNo;
    //车牌号
    $vehicleModelVisitor->licenseNo = $licenseNo;
    //初登时间
    $vehicleModelVisitor->firstRegisterDate = $firstRegisterDate;
    //车型编码
    $vehicleModelVisitor->vehicleModel = $vehicleModel;
    //$vehicleModelVisitor->vehicleModel = '';
    $vehicleModelVisitor->argc['areaCode'] = '51';
    $vehicleModelVisitor->argc['cDptCde'] = '07000002';
    $vehicleModelVisitor->argc['orderNo'] = $DAJIAOrderNo;

    $response = $IDock->vehicleModel($shortName, $vehicleModelVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\VehicleModelPrinter
     */
    $printer  = $response->getPrinter();
    var_dump($printer->toArray());
    exit;
}

//车辆实际价格
if (0) {
    //车辆实际价格
    $vehicleActualValueVisitor = new VehicleActualValueVisitor();
    $vehicleActualValueVisitor->startDate = $biStartData;
    $vehicleActualValueVisitor->firstRegisterDate = $firstRegisterDate;
    $vehicleActualValueVisitor->firstRegisterDate = $firstRegisterDate;
    //车辆价格
    $vehicleActualValueVisitor->vehiclePrice = '54800';
    //能源类型
    $vehicleActualValueVisitor->energyType = 'E01';
    //是否新能源
    $vehicleActualValueVisitor->isNewEnergy = false;
    //使用性质
    $vehicleActualValueVisitor->useNatureCode = '01';
    //车辆用途
    $vehicleActualValueVisitor->causeType = '001';
    //车辆种类
    $vehicleActualValueVisitor->carKindCode = '100';
    //座位数
    $vehicleActualValueVisitor->vehicleSeat = '5';
    //荷载质量
    $vehicleActualValueVisitor->vehicleTonnage = '0';

    $vehicleActualValueVisitor->argc['orderNo'] = $DAJIAOrderNo;

    $response = $IDock->vehicleActualValue($shortName, $vehicleActualValueVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\VehicleActualValuePrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer->toArray());
    exit;
}

//询价前置
//保费计算
//核保
if (0) {

    /**
     * 询价主信息
     */
    $premiumInquiryVisitor = new PremiumInquiryVisitor();
    //商业险起保日期
    $premiumInquiryVisitor->biStartData = $biStartData;
    //商业险终保日期
    $premiumInquiryVisitor->biEndData = $biEndData;
    //交强险起保日期
    $premiumInquiryVisitor->ciStartData = $ciStartData;
    //交强险终保日期
    $premiumInquiryVisitor->ciEndData = $ciEndData;
    //商业险即时生效
    $premiumInquiryVisitor->biEffectFlag = false;
    //交强险即时生效
    $premiumInquiryVisitor->ciEffectFlag = false;

    $premiumInquiryVisitor->isNewEnergy = false;

    /**
     * 车辆信息
     */
    $premiumVehicleVisitor = new PremiumVehicleVisitor();
    //是否新车
    $premiumVehicleVisitor->isNewVehicle = '0';
    //车架号
    $premiumVehicleVisitor->vin = $vin;
    //发动机号
    $premiumVehicleVisitor->engineNo = $engineNo;
    //车牌号
    $premiumVehicleVisitor->licenseNo = $licenseNo;
    //初登时间
    $premiumVehicleVisitor->firstRegisterDate = $firstRegisterDate;
    //过户时间
    $premiumVehicleVisitor->transferDate = '';
    //是否过户车
    $premiumVehicleVisitor->isTransfer = '';
    //发证时间
    $premiumVehicleVisitor->issueDate = '';
    //车型编码
    $premiumVehicleVisitor->vehicleModel = $vehicleModel;
    //车型编码代码
    $premiumVehicleVisitor->vehicleModelCode = 'FTAAND0134';
    //$premiumVehicleVisitor->vehicleModelCode = 'BTYOSPUB0014';
    //车型名称
    $premiumVehicleVisitor->vehicleName = '丰田TV7152X轿车';
    //车价
    $premiumVehicleVisitor->vehiclePrice = '78800';
    //车价含税
    $premiumVehicleVisitor->vehiclePriceTax = '78800';
    //协商价格
    $premiumVehicleVisitor->actualValue = '49959.2';
    //座位数
    $premiumVehicleVisitor->vehicleSeat = '8';
    //使用性质
    $premiumVehicleVisitor->useNatureCode = '01';
    //所属性质
    $premiumVehicleVisitor->attachNature = '01';
    //车辆用途
    $premiumVehicleVisitor->causeType = '001';
    //车辆种类
    $premiumVehicleVisitor->carKindCode = '100';
    //能源类型代码
    $premiumVehicleVisitor->energyTypeCode = 'E01';
    //号牌颜色代码
    $premiumVehicleVisitor->licenseColorCode = '01';
    //号牌种类代码
    $premiumVehicleVisitor->licenseTypeCode = '02';
    //交管车辆类型代码
    $premiumVehicleVisitor->vehicleStyleCode = 'K33';
    //功率
    $premiumVehicleVisitor->power = '79.0';
    //排量
    $premiumVehicleVisitor->vehicleExhaust = '1.496';
    //整备质量
    $premiumVehicleVisitor->wholeWeight = '1090';
    //荷载质量
    $premiumVehicleVisitor->vehicleTonnage = '0.0';
    //进口标识
    $premiumVehicleVisitor->vehicleImport = 'I2';
    //是否能源车
    $premiumVehicleVisitor->isNewEnergy = '0';
    //纯电续航里程(公里)
    $premiumVehicleVisitor->pureRange = '';
    //车辆来历凭证编号
    $premiumVehicleVisitor->carCertificateNo = '';
    //开具车辆来历凭证所载日期
    $premiumVehicleVisitor->carCertificateDate = '';
    //车辆来历凭证种类代码
    $premiumVehicleVisitor->carCertificateType = '';

    /**
     * 关系人
     */
    $premiumRelationVisitor = new PremiumRelationVisitor();
    //姓名
    $premiumRelationVisitor->name = '曾理';
    //联系方式
    $premiumRelationVisitor->mobile = '13550217453';
    //类型
    $premiumRelationVisitor->typeCode = 'R1';
    //证件类型
    $premiumRelationVisitor->certificateTypeCode = '01';
    //证件号码
    $premiumRelationVisitor->certificateNo = '510130197910160026';
    //地址
    $premiumRelationVisitor->address = '四川省成都市龙泉驿区龙泉车城西一路185号1栋1单元20楼2001号';
    //邮箱
    $premiumRelationVisitor->email = '18982272991@qq.com';
    //证件有效期
    $premiumRelationVisitor->certificateStartDate = '2000-01-01';
    //证件失效期
    $premiumRelationVisitor->certificateEndDate = '2050-01-01';

    /**
     * 缴税信息
     */
    $premiumCarTaxVisitor = new PremiumCarTaxVisitor();
    //缴税内心
    $premiumCarTaxVisitor->taxTypeCode = 'T01';
    //纳税人姓名
    $premiumCarTaxVisitor->taxpayerName = '曾理';
    //纳税人证件类型
    $premiumCarTaxVisitor->taxpayerCertificateTypeCode = '01';
    //纳税人证件号码
    $premiumCarTaxVisitor->taxpayerCertificateNo = '510130197910160026';
    //纳税人电话
    $premiumCarTaxVisitor->taxpayerPhone = '13550217453';
    //纳税起期
    $premiumCarTaxVisitor->taxStartDate = '';
    //纳税止期
    $premiumCarTaxVisitor->taxEndDate = '';
    //减免税方案代码
    $premiumCarTaxVisitor->taxReductionCode = '';
    //减免税原因代码
    $premiumCarTaxVisitor->taxReductionReasonCode = '';
    //税务机关名称
    $premiumCarTaxVisitor->taxDepartment = '';
    //税务机关代码
    $premiumCarTaxVisitor->taxDepartmentCode = '';
    //开具完税凭证地区代码
    $premiumCarTaxVisitor->taxPaidAreaCode = '';
    //完税凭证填发日期
    $premiumCarTaxVisitor->taxDocumentDate = '';
    //减免比例 百分比
    $premiumCarTaxVisitor->taxFreeRate = '';
    //减税金额 元
    $premiumCarTaxVisitor->taxExemption = '';
    //减免完税凭证号
    $premiumCarTaxVisitor->taxDocumentNumber = '';

    //险种
    $premiumCoverageVisitor = new PremiumCoverageVisitor();
    $premiumCoverageVisitor->coverageCode = 'C02001';
    $premiumCoverageVisitor->amount = '8400';
    //
    $premiumCoverageVisitor3 = new PremiumCoverageVisitor();
    $premiumCoverageVisitor3->coverageCode = 'C03001';
    $premiumCoverageVisitor3->amount = '1000000';

    //
    $premiumCoverageVisitor1 = new PremiumCoverageVisitor();
    $premiumCoverageVisitor1->coverageCode = 'C04001';
    $premiumCoverageVisitor1->amount = '10000';

    $premiumCoverageVisitor2 = new PremiumCoverageVisitor();
    $premiumCoverageVisitor2->coverageCode = 'C05001';
    $premiumCoverageVisitor2->unitAmount = '10000';

    //险种添加
    $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor);
    $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor1);
    $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor2);
    $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor3);

    //新能源充电桩信息
    $premiumChargingPileVisitor = new PremiumChargingPileVisitor();

    $premiumChargingPileVisitor->seqNo = '1';
    //充电桩类型
    $premiumChargingPileVisitor->chargingPileKind = 'PK1';
    //充电桩安装地点类型
    $premiumChargingPileVisitor->chargingPileAddressType = 'PA1';
    //充电桩使用年限
    $premiumChargingPileVisitor->chargingPileYearLimit = 'PY1';
    //充电桩编码
    $premiumChargingPileVisitor->chargingPileCode = '123456';
    //充电桩型号
    $premiumChargingPileVisitor->chargingPileType = 'BCS100500';
    //充电桩地址
    $premiumChargingPileVisitor->chargingPileAddress = '地面充电桩';
    //损失保险保额
    $premiumChargingPileVisitor->lossAmount = '';
    //责任保险保额
    $premiumChargingPileVisitor->liabilityAmount = '10000';

    /**
     * 拓展信息
     */
    $premiumExtInfoVisitor = new PremiumExtInfoVisitor();
    //验车情况
    $premiumExtInfoVisitor->carCheckCode = '';
    //免验原因
    $premiumExtInfoVisitor->carCheckReasonKind = '';
    //验车人
    $premiumExtInfoVisitor->carChecker = '';
    //验车日期
    $premiumExtInfoVisitor->carCheckDate = '';
    //验车地点
    $premiumExtInfoVisitor->carAddress = '';
    //是否送修
    $premiumExtInfoVisitor->isMonopoly = '';
    //送修代码
    $premiumExtInfoVisitor->repairCode = '';
    //送修名称
    $premiumExtInfoVisitor->repairName = '';
    //自主定价系数
    $premiumExtInfoVisitor->selfPricingFactor = '';
    //自主核保系数
    $premiumExtInfoVisitor->underwritingFactor = '';
    //期望折扣
    $premiumExtInfoVisitor->expectedDiscount = '';
    //是否贷款车
    $premiumExtInfoVisitor->isLoanCar = '';
    //贷款机构名称
    $premiumExtInfoVisitor->loanOrg = '';

    //安诚拓展
    $premiumExtInfoVisitor->argc['AreaCode'] = '51';
    $premiumExtInfoVisitor->argc['OrgCode'] = '51080503';

    //添加车辆信息
    $premiumInquiryVisitor->setVehicleVisitor($premiumVehicleVisitor);
    //添加投保人
    $premiumInquiryVisitor->setApplicantVisitor($premiumRelationVisitor);
    //添加被保人
    $premiumInquiryVisitor->setInsuredVisitor($premiumRelationVisitor);
    //添加车主
    $premiumInquiryVisitor->setOwnerVisitor($premiumRelationVisitor);
    //车船税
    $premiumInquiryVisitor->setCarTaxVisitor($premiumCarTaxVisitor);

    //新能源充电桩
    $premiumInquiryVisitor->chargingPileVisitorAppend($premiumChargingPileVisitor);
    //拓展信息
    $premiumInquiryVisitor->setExtInfoVisitor($premiumExtInfoVisitor);

    //询价前置
    //$response = $IDock->preInquiry($shortName, $premiumInquiryVisitor);
    //var_dump($response->isSuccess());
    //var_dump($response->getError());
    /**
     * @var $printer \IDock\Printer\preInquiryPrinter;
     */
    //$printer = $response->getPrinter();
    //var_dump($printer->toArray());
    //exit;

/*    $testResponse  ='<?xml version="1.0" encoding="UTF-8"?><Packet>  <Head>    <RequestType>V00</RequestType>    <SerialNo>a80bc1b9aab5335a4be3a7617a141e21dae4d2f2</SerialNo>    <ResponseCode>0</ResponseCode>    <ErrorCode>0000</ErrorCode>    <ErrorMessage>成功</ErrorMessage>  </Head><Body><CI><DupFlag>1</DupFlag><RepeatInfo><EndDate></EndDate><RepeatDesc>E51--交强投保查询与平台交互异常*/
//车险平台返回信息
//号牌号码“川K2X288”的保单发生重复投保，与其重复投保的其它公司的保单信息如下：车架号 LSYYBACA79K013367;发动机号 CD96A6493;地区 四川。*</RepeatDesc></RepeatInfo></CI><BI><DupFlag>1</DupFlag><RepeatInfo><EndDate>202309290000</EndDate><RepeatDesc>核心返回结果: 计算完毕 【请注意商业重复投保信息】： 商业：车险平台返回信息 重复投保保单号： PDEJ22510112250000001174 保险公司代码：CCIC 保险公司名称：中国大地财产保险股份有限公司 号牌号码：川K2X288 号牌种类代码：02 号牌种类名称：小型汽车号牌 车架号：LSYYBACA79K013367 发动机号：CD96A6493 签单日期：20220902 起保日期：202209290000 终保日期：202309290000 重复险别： 0301600 机动车第三者责任保险; 商业：车险平台返回信息 重复投保保单号： 保险公司代码： 保险公司名称： 号牌号码： 号牌种类代码： 号牌种类名称： 车架号：LSYYBACA79K013367 发动机号：CD96A6493 签单日期： 起保日期： 终保日期： 重复险别： 0301604 附加法定节假日限额翻倍险; 0301002 附加医保外用药责任险（机动车第三者责任保险）; 0301701 机动车车上人员责任保险（司机）; 0301011 附加医保外用药责任险（机动车车上人员责任保险（司机））; 0301702 机动车车上人员责任保险（乘客）; 0301012 附加医保外用药责任险（机动车车上人员责任保险（乘客））; 0301003 道路救援服务特约条款; 0301004 车辆安全检测特约条款; 0301005 代为驾驶服务特约条款; 0301006 代为送检服务特约条款;</RepeatDesc></RepeatInfo></BI></Body></Packet>';
    //
    $testResponse = '<?xml version="1.0" encoding="UTF-8"?><Packet>  <Head>    <RequestType>V00</RequestType>    <SerialNo>bf627a1fa7e9f286659483b3c87b7b0a1a1b34f0</SerialNo>    <ResponseCode>0</ResponseCode>    <ErrorCode>0000</ErrorCode>    <ErrorMessage>成功</ErrorMessage>  </Head><Body><TotalPrem>2172.79</TotalPrem><TotalSumlimit>1288400.0</TotalSumlimit><CHDRiskInfo>{"cEngNo":"B7CF075342","cpkid":"ff8080818c258eee018c288df56b454e","cstatus":"1","dptCde":"51 ","plateNo":"川A580FE","priScore":"97.62","priTranche":"1","status":"1","tCrtTm":1701487441000,"type":"B","vin":"LS4ASB3R6BA095389"}</CHDRiskInfo><TotalPremAndTax>2472.79</TotalPremAndTax><CI><CQueryNo>599510803602023073026</CQueryNo><Prem>1100.0</Prem><Tax>300.0</Tax><RenewFlag>0</RenewFlag><DPrem>1100.0</DPrem><Discount>1.0</Discount><DupFlag>0</DupFlag><TaxDetail><AnnualTaxDue>300.0</AnnualTaxDue><SumTaxDefault>0.0</SumTaxDefault><SumOverdue>0.0</SumOverdue></TaxDetail><SpecialContact>四川保险业消费者权益保护中心维权热线：028-841-12378。@因履行本保险合同发生的争议，除条款约定的合同争议解决方式外，还可向四川保险业消费者权益保护中心申请调解。@温馨提示：尊敬的客户，投保次日起，您可通过本网站、客服电话、营业网点核实保单及理赔等信息。若对查询结果有异议，请联系本公司。联系方式：网址：http://www.e-acic.com 电话：95544。@2023年3季度，我司综合偿付能力充足率为271.12%，符合监管要求。2023年2季度，我司风险综合评级（分类监管）为B 。 @本保单保险费为含税金额，其中不含税保险费**元、增值税**元。@本车险相关信息将由本公司共享至四川省保险行业协会，用于（且仅用于）行业与交管等政府部门进行信息共享，用于风险防范、社会管理等目的。@本车辆被保险人为：李术根，行驶证车主为：胡玉君</SpecialContact><CIExpectedLossRatio>0.8722</CIExpectedLossRatio><BIExpectedLossRatio>0.0</BIExpectedLossRatio><TExpectedLossRatio>0.8722</TExpectedLossRatio><PreUndrMsg>自核结果为：下发修改。单车核保通则库_总部：被保险人与车主不一致;</PreUndrMsg><NewFuelVhlFlag>0</NewFuelVhlFlag><ChangedVehlValue>8400</ChangedVehlValue><DRUBIType></DRUBIType><DRUBIScore></DRUBIScore><AcicVhlScore></AcicVhlScore><NewImageID>2023120213312900185294</NewImageID></CI><BI><QueryPastDate></QueryPastDate><RenewFlag>0</RenewFlag><BQueryNo>599510803662023085813</BQueryNo><BPremium>1072.79</BPremium><BSumlimit>1088400.0</BSumlimit><CoverageItem><CoverageCode>0101200</CoverageCode><Premium>531.55</Premium><Sumlimit>8400.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>0101600</CoverageCode><Premium>457.5</Premium><Sumlimit>1000000.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>0101701</CoverageCode><Premium>15.26</Premium><Sumlimit>10000.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>0101702</CoverageCode><Premium>68.48</Premium><Sumlimit>70000.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>2020005</CoverageCode><Premium>0.0</Premium><Sumlimit>0.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><Discount>0.567</Discount><BDPremium>1892.05</BDPremium><NCD>0.7</NCD><DupFlag>0</DupFlag><PlateTransferType></PlateTransferType><SpecialContact>四川保险业消费者权益保护中心维权热线：028-841-12378。@因履行本保险合同发生的争议，除条款约定的合同争议解决方式外，还可向四川保险业消费者权益保护中心申请调解。@温馨提示：尊敬的客户，投保次日起，您可通过本网站、客服电话、营业网点核实保单及理赔等信息。若对查询结果有异议，请联系本公司。联系方式：网址：http://www.e-acic.com 电话：95544。@2023年3季度，我司综合偿付能力充足率为271.12%，符合监管要求。2023年2季度，我司风险综合评级（分类监管）为B 。 @本车险相关信息将由本公司共享至四川省保险行业协会，用于（且仅用于）行业与交管等政府部门进行信息共享，用于风险防范、社会管理等目的。@本保单保险费为含税金额，其中不含税保险费**元、增值税**元。@本车辆被保险人为：李术根，行驶证车主为：胡玉君</SpecialContact><NCDFlag>1</NCDFlag><AutoPriceDiscount>0.81</AutoPriceDiscount><CIExpectedLossRatio>0.5788</CIExpectedLossRatio><BIExpectedLossRatio>0.6734</BIExpectedLossRatio><TExpectedLossRatio>0.6255</TExpectedLossRatio><ReInsureItem></ReInsureItem><VhlSimpleFreeRate>0.0</VhlSimpleFreeRate><AdviceDiscount>0.367955</AdviceDiscount><PreUndrMsg>交强险提示信息：自核结果为：下发修改。单车核保通则库_总部：被保险人与车主不一致; 商业险提示信息：自核结果为：下发修改。单车核保通则库_总部：被保险人与车主不一致;</PreUndrMsg><NewFuelVhlFlag>0</NewFuelVhlFlag><ChangedVehlValue>8400</ChangedVehlValue><ChargingPostInfoList></ChargingPostInfoList><DRUBIType></DRUBIType><DRUBIScore></DRUBIScore><AcicVhlScore></AcicVhlScore><NewImageID>2023120213312900185294</NewImageID></BI><MFileList><MFileItem><FileType>1002</FileType><FileDesc>投保人身份证</FileDesc></MFileItem><MFileItem><FileType>1003</FileType><FileDesc>被保人身份证</FileDesc></MFileItem><MFileItem><FileType>1004</FileType><FileDesc>行驶证</FileDesc></MFileItem><MFileItem><FileType>1005</FileType><FileDesc>验车照</FileDesc></MFileItem><MFileItem><FileType>1006</FileType><FileDesc>验车报告</FileDesc></MFileItem><MFileItem><FileType>1010</FileType><FileDesc>上年保单证明资料</FileDesc></MFileItem></MFileList></Body></Packet>';

    if (1) {
        $response = $IDock->premiumInquiry($shortName, $premiumInquiryVisitor);

        if (!$response->isSuccess()) {
            var_dump($response->getError());
        } else {
            /*** @var $printer PremiumInquiryPrinter; */
            $printer = $response->getPrinter();
            var_dump($response->getPrinter()->toArray());
        }

        exit;
    }
    //询价

    $premiumInquiryVisitor->fileAppend('','','');

    /**
     * 核保信息
     */
    $premiumUnderwritingVisitor = new PremiumUnderwritingVisitor();
    $premiumUnderwritingVisitor->inquiryNo = '';
    $premiumUnderwritingVisitor->biInquiryNo = '599510803662023000190';
    $premiumUnderwritingVisitor->ciInquiryNo = '599510803602023000152';

    $specialClauses = new SpecialClausesVisitor();
    $specialClauses->clauseCode = '0256';
    $specialClauses->clauseName = '0256';
    $specialClauses->clauseContent = '本保单保险费为含税金额，其中不含税保险费**元、增值税**元。';
    $specialClauses->clauseType  = '0';
    $specialClauses->riskType = 'TCI';
    $specialClauses->autoFlag = '1';

    $specialClauses2 = new SpecialClausesVisitor();
    $specialClauses2->clauseCode = '0251';
    $specialClauses2->clauseName = '0251';
    $specialClauses2->clauseContent = '若本车用于营业用途发生事故，保险人对事故造成的损失不承担赔偿责任。';
    $specialClauses2->clauseType  = '0';
    $specialClauses2->riskType = 'VCI';
    $specialClauses2->autoFlag = '0';

    $premiumUnderwritingVisitor->specialClausesAppend($specialClauses);
    $premiumUnderwritingVisitor->specialClausesAppend($specialClauses2);

    $premiumInquiryVisitor->setUnderwritingVisitor($premiumUnderwritingVisitor);

    $testResponse = '<?xml version="1.0" encoding="UTF-8"?><Packet><Head><RequestType>V01</RequestType><SerialNo>2852b906f0e8da1ff2d528d18c258b59f21b8f74</SerialNo><ResponseCode>0</ResponseCode><ErrorCode>0000</ErrorCode><ErrorMessage>成功</ErrorMessage></Head><Body><ConfirmNo>599510803602023050895599510803662023057864</ConfirmNo><TotalPrem>2170.77</TotalPrem><TotalSumlimit>2474502.4</TotalSumlimit><TotalPremAndTax>2470.77</TotalPremAndTax><CI><CConfirmNo>599510803602023050895</CConfirmNo><Prem>880.0</Prem><Tax>300.0</Tax><UWFlag>1</UWFlag><UWMessage>599510803602023050895核保状态(1) 上报成功!目标核保级别：四川分公司一般核保员</UWMessage></CI><BI><BConfirmNo>599510803662023057864</BConfirmNo><BPremium>1290.77</BPremium><BSumlimit>2274502.4</BSumlimit><UWFlag>1</UWFlag><UWMessage>599510803662023057864核保状态(1) 上报成功!目标核保级别：四川分公司一般核保员</UWMessage></BI><UWFlag>1</UWFlag></Body></Packet>';

    //核保
    $response = $IDock->underwriting($shortName, $premiumInquiryVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\PremiumUnderwritingPrinter;
     */
    $printer = $response->getPrinter();

    var_dump($printer->toArray());
    exit;
}

//支付
if (0) {
    $policyPaymentVisitor = new PolicyPaymentVisitor();
    $policyPaymentVisitor->inquiryNo = '599510803602023000184';
    $policyPaymentVisitor->biInquiryNo = '';
    $policyPaymentVisitor->ciInquiryNo = '599510803602023000184';

    $response = $IDock->policyPayment($shortName, $policyPaymentVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());
    /**
     * @var $printer \IDock\Printer\PolicyPaymentPrinter
     */
    $printer = $response->getPrinter();

    var_dump($printer->toArray());
    exit;
}

//影像资料上传
if (0) {
    $uploadFileVisitor = new UploadFileVisitor();
    $uploadFileVisitor->inquiryNo = '599510803602023000152599510803662023000190';
    $uploadFileVisitor->biInquiryNo = '599510803662023000190';
    $uploadFileVisitor->ciInquiryNo = '599510803602023000152';

    $uploadFileVisitor->fileAppend('10010', 'https://p0.itc.cn/q_70/images03/20220512/77ed76720a1f40ef94948761dda05655.jpeg');

    $response = $IDock->uploadFile($shortName, $uploadFileVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var  $printer \IDock\Printer\UploadFilePrinter
     */
    $printer = $response->getPrinter();

    var_dump($printer->toArray());
    exit;
}

//投保单查询
if (0) {


    $testResponse = '<?xml version="1.0" encoding="UTF-8"?><Packet>  <Head>    <RequestType>Q03</RequestType>    <SerialNo>ea46b41c502696977eca84dcfb207347f359885a</SerialNo>    <ResponseCode>0</ResponseCode>    <ErrorCode>0000</ErrorCode>    <ErrorMessage>成功</ErrorMessage>  </Head><Body><CI><CConfirmNo>599510803602023047098</CConfirmNo><CPolicyNo></CPolicyNo><PolicyCrtTime></PolicyCrtTime><YBPayType></YBPayType><YBPaySerialNo></YBPaySerialNo><EffectiveDate></EffectiveDate><ExpireDate></ExpireDate><UWStatus>1</UWStatus><UWDesc>数据质量库：自核通过; 数据质量库：自核通过; 数据质量库：自核通过;</UWDesc><UWTime>2023-08-07 11:41:59.0</UWTime></CI><BI><BConfirmNo>599510803662023053339</BConfirmNo><BPolicyNo></BPolicyNo><PolicyCrtTime></PolicyCrtTime><YBPayType></YBPayType><YBPaySerialNo></YBPaySerialNo><EffectiveDate></EffectiveDate><ExpireDate></ExpireDate><UWStatus>6</UWStatus><UWDesc>核保规则触发原因:车上人员责任限额小于1万，分公司不能核保</UWDesc><UWTime>2023-08-07 11:42:07.0</UWTime></BI></Body></Packet>';
    $proposalStatusVisitor = new ProposalStatusVisitor();

    $proposalStatusVisitor->inquiryNo = '599510803602023046042599510803662023052208';
    $proposalStatusVisitor->biInquiryNo = '599510803662023052208';
    $proposalStatusVisitor->ciInquiryNo = '599510803602023046042';

    $response = $IDock->proposalStatus($shortName, $proposalStatusVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /*** @var $printer ProposalStatusPrinter; */
    $printer = $response->getPrinter();

    var_dump($printer);
    exit;
}

//撤单
if (0) {
    $proposalRecallVisitor = new ProposalRecallVisitor();

    $proposalRecallVisitor->inquiryNo = '599510803602024000018';
    $proposalRecallVisitor->biInquiryNo = '599510803662024000021';
    $proposalRecallVisitor->ciInquiryNo = '599510803602024000018';
    $proposalRecallVisitor->reason = '客户注销';
    $proposalRecallVisitor->argc['OrgCode'] = '51080503';

    $response = $IDock->proposalRecall($shortName, $proposalRecallVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\ProposalRecallPrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer->toArray());
    exit;
}

//核保撤单
if (0) {
    $underwritingRecallVisitor = new UnderwritingRecallVisitor();

    $underwritingRecallVisitor->inquiryNo = '599510803602024000020';
    $underwritingRecallVisitor->biInquiryNo = '599510803662024000023';
    $underwritingRecallVisitor->ciInquiryNo = '599510803602024000020';
    $underwritingRecallVisitor->reason = '投保注销';
    $underwritingRecallVisitor->argc['OrgCode'] = '51080503';

    $response = $IDock->underwritingRecall($shortName,$underwritingRecallVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\UnderwritingRecallPrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer->toArray());
    exit;

}

//电子保单下载
if (0) {
    $EPolicyDownloadVisitor = new EPolicyDownloadVisitor();

    $EPolicyDownloadVisitor->policyNo = '299510803662023000014';

    $response = $IDock->EPolicyDownload($shortName, $EPolicyDownloadVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());


    /**
     * @var $printer \IDock\Printer\EPolicyDownloadPrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer);
    exit;
}

//保单详情
if (0) {
    $policyInfoVisitor = new PolicyInfoVisitor();

    $policyInfoVisitor->policyNo = '299510803602023000033';

    $response = $IDock->policyInfo($shortName, $policyInfoVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());
    var_dump($response->getPrinter()->toArray());
    exit;
}

/**
 * 非车相关接口
 */

//非车产品列表
if (0) {

}

//非车投保单查询接口
if (1) {
    $appNo = '5106760912024022002473902024905T';

    /*** @var $acic ACICConstruct */
    $acic = $IDock->getBean('ACIC');
    $response = $acic->nonCarInquiryInfo($appNo);

    var_dump($response);
}
